import Vue from 'vue';
import $ from 'jquery';
var URI = require('../../UriConst');

export const getCameras = ({ commit,  state}, params) => {
    console.info("action getCameras begin" + `, url:${URI.getCameras}`);
    return new Promise((resolve, reject) => {
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: `${URI.getCameras}`,
            async: true,
            success: response => {
                console.info("action getCameras  success");
                commit('requestCameras', response);
                resolve();
            },
            error: err => {
                console.info("action getCameras  failed");
                commit('requestFailed', {
                     error: err
                 });
                reject(err);
            }
        });
    });
};

export const startAllAnalyzes = ({ commit,  state}, params) => {
};

export const stopAllAnalyzes = ({ commit, state}) => {
};

export const startAnalyzeById = ({commit,state}) => {
    console.error("unpublish stream");
};

export const stopAnalyzeById = ({commit,state}) => {
    console.error("subscribe stream");
};

export const getAnalyzeById = ({commit,state}) => {
    console.error("subscribe stream");
};
